package com.joanzapata.pdfview;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.AttributeSet;
import android.view.SurfaceView;
import com.joanzapata.pdfview.SpiralLoopManager;
import com.joanzapata.pdfview.exception.FileNotFoundException;
import com.joanzapata.pdfview.listener.OnDrawListener;
import com.joanzapata.pdfview.listener.OnLoadCompleteListener;
import com.joanzapata.pdfview.listener.OnPageChangeListener;
import com.joanzapata.pdfview.model.PagePart;
import com.joanzapata.pdfview.util.ArrayUtils;
import com.joanzapata.pdfview.util.Constants;
import com.joanzapata.pdfview.util.FileUtils;
import com.joanzapata.pdfview.util.NumberUtils;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import org.vudroid.core.DecodeService;

/* loaded from: classes.dex */
public class PDFView extends SurfaceView {
    private static final String TAG = PDFView.class.getSimpleName();
    private AnimationManager animationManager;
    private CacheManager cacheManager;
    private int currentFilteredPage;
    private int currentPage;
    private float currentXOffset;
    private float currentYOffset;
    private Paint debugPaint;
    private DecodeService decodeService;
    private DecodingAsyncTask decodingAsyncTask;
    private int defaultPage;
    private int documentPageCount;
    private DragPinchManager dragPinchManager;
    private int[] filteredUserPageIndexes;
    private int[] filteredUserPages;
    private RectF leftMask;
    private Paint maskPaint;
    private boolean miniMapRequired;
    private RectF minimapBounds;
    private RectF minimapScreenBounds;
    private OnDrawListener onDrawListener;
    private OnLoadCompleteListener onLoadCompleteListener;
    private OnPageChangeListener onPageChangeListener;
    private float optimalPageHeight;
    private float optimalPageWidth;
    private int[] originalUserPages;
    private int pageHeight;
    private int pageWidth;
    private Paint paint;
    private Paint paintMinimapBack;
    private Paint paintMinimapFront;
    private boolean recycled;
    private RenderingAsyncTask renderingAsyncTask;
    private RectF rightMask;
    private State state;
    private boolean swipeVertical;
    private boolean userWantsMinimap;
    private float zoom;

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public enum State {
        DEFAULT,
        LOADED,
        SHOWN
    }

    public PDFView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.currentXOffset = 0.0f;
        this.currentYOffset = 0.0f;
        this.zoom = 1.0f;
        this.recycled = true;
        this.state = State.DEFAULT;
        this.defaultPage = 0;
        this.userWantsMinimap = false;
        this.swipeVertical = false;
        this.miniMapRequired = false;
        this.cacheManager = new CacheManager();
        this.animationManager = new AnimationManager(this);
        this.dragPinchManager = new DragPinchManager(this);
        this.paint = new Paint();
        this.debugPaint = new Paint();
        this.debugPaint.setStyle(Paint.Style.STROKE);
        this.paintMinimapBack = new Paint();
        this.paintMinimapBack.setStyle(Paint.Style.FILL);
        this.paintMinimapBack.setColor(-16777216);
        this.paintMinimapBack.setAlpha(50);
        this.paintMinimapFront = new Paint();
        this.paintMinimapFront.setStyle(Paint.Style.FILL);
        this.paintMinimapFront.setColor(-16777216);
        this.paintMinimapFront.setAlpha(50);
        setWillNotDraw(false);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void load(Uri uri, OnLoadCompleteListener onLoadCompleteListener) {
        load(uri, onLoadCompleteListener, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void load(Uri uri, OnLoadCompleteListener onLoadCompleteListener, int[] iArr) {
        if (!this.recycled) {
            throw new IllegalStateException("Don't call load on a PDF View without recycling it first.");
        }
        if (iArr != null) {
            this.originalUserPages = iArr;
            this.filteredUserPages = ArrayUtils.deleteDuplicatedPages(this.originalUserPages);
            this.filteredUserPageIndexes = ArrayUtils.calculateIndexesInDuplicateArray(this.originalUserPages);
        }
        this.onLoadCompleteListener = onLoadCompleteListener;
        this.decodingAsyncTask = new DecodingAsyncTask(uri, this);
        this.decodingAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
        this.renderingAsyncTask = new RenderingAsyncTask(this);
        this.renderingAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
    }

    public void jumpTo(int i) {
        showPage(i - 1);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void showPage(int i) {
        this.state = State.SHOWN;
        int determineValidPageNumberFrom = determineValidPageNumberFrom(i);
        this.currentPage = determineValidPageNumberFrom;
        this.currentFilteredPage = determineValidPageNumberFrom;
        int[] iArr = this.filteredUserPageIndexes;
        if (iArr != null && determineValidPageNumberFrom >= 0 && determineValidPageNumberFrom < iArr.length) {
            determineValidPageNumberFrom = iArr[determineValidPageNumberFrom];
            this.currentFilteredPage = determineValidPageNumberFrom;
        }
        resetZoom();
        if (this.swipeVertical) {
            this.animationManager.startYAnimation(this.currentYOffset, calculateCenterOffsetForPage(determineValidPageNumberFrom));
        } else {
            this.animationManager.startXAnimation(this.currentXOffset, calculateCenterOffsetForPage(determineValidPageNumberFrom));
        }
        loadPages();
        OnPageChangeListener onPageChangeListener = this.onPageChangeListener;
        if (onPageChangeListener != null) {
            onPageChangeListener.onPageChanged(this.currentPage + 1, getPageCount());
        }
    }

    public int getPageCount() {
        int[] iArr = this.originalUserPages;
        if (iArr != null) {
            return iArr.length;
        }
        return this.documentPageCount;
    }

    public void enableSwipe(boolean z) {
        this.dragPinchManager.setSwipeEnabled(z);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void setOnPageChangeListener(OnPageChangeListener onPageChangeListener) {
        this.onPageChangeListener = onPageChangeListener;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void setOnDrawListener(OnDrawListener onDrawListener) {
        this.onDrawListener = onDrawListener;
    }

    public void recycle() {
        RenderingAsyncTask renderingAsyncTask = this.renderingAsyncTask;
        if (renderingAsyncTask != null) {
            renderingAsyncTask.cancel(true);
        }
        DecodingAsyncTask decodingAsyncTask = this.decodingAsyncTask;
        if (decodingAsyncTask != null) {
            decodingAsyncTask.cancel(true);
        }
        this.cacheManager.recycle();
        this.recycled = true;
        this.state = State.DEFAULT;
    }

    @Override // android.view.SurfaceView, android.view.View
    protected void onDetachedFromWindow() {
        recycle();
    }

    @Override // android.view.View
    protected void onSizeChanged(int i, int i2, int i3, int i4) {
        this.animationManager.stopAll();
        calculateOptimalWidthAndHeight();
        loadPages();
        if (this.swipeVertical) {
            moveTo(this.currentXOffset, calculateCenterOffsetForPage(this.currentFilteredPage));
        } else {
            moveTo(calculateCenterOffsetForPage(this.currentFilteredPage), this.currentYOffset);
        }
    }

    @Override // android.view.View
    protected void onDraw(Canvas canvas) {
        canvas.drawColor(-1);
        if (this.state != State.SHOWN) {
            return;
        }
        float f = this.currentXOffset;
        float f2 = this.currentYOffset;
        canvas.translate(f, f2);
        Iterator<PagePart> it = this.cacheManager.getThumbnails().iterator();
        while (it.hasNext()) {
            drawPart(canvas, it.next());
        }
        Iterator<PagePart> it2 = this.cacheManager.getPageParts().iterator();
        while (it2.hasNext()) {
            drawPart(canvas, it2.next());
        }
        if (this.onDrawListener != null) {
            canvas.translate(toCurrentScale(this.currentFilteredPage * this.optimalPageWidth), 0.0f);
            this.onDrawListener.onLayerDrawn(canvas, toCurrentScale(this.optimalPageWidth), toCurrentScale(this.optimalPageHeight), this.currentPage);
            canvas.translate(-toCurrentScale(this.currentFilteredPage * this.optimalPageWidth), 0.0f);
        }
        canvas.translate(-f, -f2);
        canvas.drawRect(this.leftMask, this.maskPaint);
        canvas.drawRect(this.rightMask, this.maskPaint);
        if (this.userWantsMinimap && this.miniMapRequired) {
            drawMiniMap(canvas);
        }
    }

    public void onLayerUpdate() {
        invalidate();
    }

    private void drawPart(Canvas canvas, PagePart pagePart) {
        float currentScale;
        float f;
        RectF pageRelativeBounds = pagePart.getPageRelativeBounds();
        Bitmap renderedBitmap = pagePart.getRenderedBitmap();
        if (this.swipeVertical) {
            f = toCurrentScale(pagePart.getUserPage() * this.optimalPageHeight);
            currentScale = 0.0f;
        } else {
            currentScale = toCurrentScale(pagePart.getUserPage() * this.optimalPageWidth);
            f = 0.0f;
        }
        canvas.translate(currentScale, f);
        Rect rect = new Rect(0, 0, renderedBitmap.getWidth(), renderedBitmap.getHeight());
        float currentScale2 = toCurrentScale(pageRelativeBounds.left * this.optimalPageWidth);
        float currentScale3 = toCurrentScale(pageRelativeBounds.top * this.optimalPageHeight);
        RectF rectF = new RectF((int) currentScale2, (int) currentScale3, (int) (currentScale2 + toCurrentScale(pageRelativeBounds.width() * this.optimalPageWidth)), (int) (currentScale3 + toCurrentScale(pageRelativeBounds.height() * this.optimalPageHeight)));
        float f2 = this.currentXOffset + currentScale;
        float f3 = this.currentYOffset + f;
        if (rectF.left + f2 >= getWidth() || f2 + rectF.right <= 0.0f || rectF.top + f3 >= getHeight() || f3 + rectF.bottom <= 0.0f) {
            canvas.translate(-currentScale, -f);
            return;
        }
        canvas.drawBitmap(renderedBitmap, rect, rectF, this.paint);
        canvas.translate(-currentScale, -f);
    }

    private void drawMiniMap(Canvas canvas) {
        canvas.drawRect(this.minimapBounds, this.paintMinimapBack);
        canvas.drawRect(this.minimapScreenBounds, this.paintMinimapFront);
    }

    public void loadPages() {
        if (this.optimalPageWidth == 0.0f || this.optimalPageHeight == 0.0f) {
            return;
        }
        this.renderingAsyncTask.removeAllTasks();
        this.cacheManager.makeANewSet();
        int i = this.currentPage;
        int[] iArr = this.filteredUserPageIndexes;
        if (iArr != null) {
            i = iArr[i];
        }
        int i2 = 0;
        for (int i3 = 0; i3 <= 1 && i2 < Constants.Cache.CACHE_SIZE; i3++) {
            i2 += loadPage(i + i3, Constants.Cache.CACHE_SIZE - i2);
            if (i3 != 0 && i2 < Constants.Cache.CACHE_SIZE) {
                i2 += loadPage(i - i3, Constants.Cache.CACHE_SIZE - i2);
            }
        }
        invalidate();
    }

    private int loadPage(int i, int i2) {
        int i3;
        float f;
        int i4;
        int[] iArr = this.filteredUserPages;
        if (iArr == null) {
            i3 = i;
        } else if (i < 0 || i >= iArr.length) {
            return 0;
        } else {
            i3 = iArr[i];
        }
        if (i3 < 0 || i >= this.documentPageCount) {
            return 0;
        }
        if (this.cacheManager.containsThumbnail(i, i3, (int) (this.optimalPageWidth * 0.2f), (int) (this.optimalPageHeight * 0.2f), new RectF(0.0f, 0.0f, 1.0f, 1.0f))) {
            f = 1.0f;
            i4 = 0;
        } else {
            f = 1.0f;
            i4 = 0;
            this.renderingAsyncTask.addRenderingTask(i, i3, (int) (this.optimalPageWidth * 0.2f), (int) (this.optimalPageHeight * 0.2f), new RectF(0.0f, 0.0f, 1.0f, 1.0f), true, 0);
        }
        float f2 = f / this.optimalPageWidth;
        float f3 = this.zoom;
        int ceil = (int) Math.ceil(f / (((f / this.optimalPageHeight) * 256.0f) / f3));
        int ceil2 = (int) Math.ceil(f / ((f2 * 256.0f) / f3));
        float f4 = ceil2;
        float f5 = f / f4;
        float f6 = ceil;
        float f7 = f / f6;
        float width = (-this.currentXOffset) + (getWidth() / 2);
        float height = (-this.currentYOffset) + (getHeight() / 2);
        if (this.swipeVertical) {
            width -= i * toCurrentScale(this.optimalPageWidth);
        } else {
            height -= i * toCurrentScale(this.optimalPageHeight);
        }
        float currentScale = width / toCurrentScale(this.optimalPageWidth);
        int limit = NumberUtils.limit((int) ((height / toCurrentScale(this.optimalPageHeight)) * f6), i4, ceil);
        int limit2 = NumberUtils.limit((int) (currentScale * f4), i4, ceil2);
        C1SpiralLoopListenerImpl c1SpiralLoopListenerImpl = new C1SpiralLoopListenerImpl(f5, f7, i, i3, i2);
        new SpiralLoopManager(c1SpiralLoopListenerImpl).startLoop(ceil, ceil2, limit, limit2);
        return c1SpiralLoopListenerImpl.nbItemTreated;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: com.joanzapata.pdfview.PDFView$1SpiralLoopListenerImpl  reason: invalid class name */
    /* loaded from: classes.dex */
    public class C1SpiralLoopListenerImpl implements SpiralLoopManager.SpiralLoopListener {
        int nbItemTreated = 0;
        final /* synthetic */ int val$documentPageFinal;
        final /* synthetic */ int val$nbOfPartsLoadable;
        final /* synthetic */ float val$pageRelativePartHeight;
        final /* synthetic */ float val$pageRelativePartWidth;
        final /* synthetic */ int val$userPage;

        C1SpiralLoopListenerImpl(float f, float f2, int i, int i2, int i3) {
            this.val$pageRelativePartWidth = f;
            this.val$pageRelativePartHeight = f2;
            this.val$userPage = i;
            this.val$documentPageFinal = i2;
            this.val$nbOfPartsLoadable = i3;
        }

        @Override // com.joanzapata.pdfview.SpiralLoopManager.SpiralLoopListener
        public boolean onLoop(int i, int i2) {
            float f = this.val$pageRelativePartWidth;
            float f2 = i2 * f;
            float f3 = this.val$pageRelativePartHeight;
            float f4 = i * f3;
            float f5 = 256.0f / f;
            float f6 = 256.0f / f3;
            if (f2 + f > 1.0f) {
                f = 1.0f - f2;
            }
            if (f4 + f3 > 1.0f) {
                f3 = 1.0f - f4;
            }
            float f7 = f5 * f;
            float f8 = f6 * f3;
            RectF rectF = new RectF(f2, f4, f + f2, f3 + f4);
            if (f7 != 0.0f && f8 != 0.0f && !PDFView.this.cacheManager.upPartIfContained(this.val$userPage, this.val$documentPageFinal, f7, f8, rectF, this.nbItemTreated)) {
                PDFView.this.renderingAsyncTask.addRenderingTask(this.val$userPage, this.val$documentPageFinal, f7, f8, rectF, false, this.nbItemTreated);
            }
            this.nbItemTreated++;
            return this.nbItemTreated < this.val$nbOfPartsLoadable;
        }
    }

    public void loadComplete(DecodeService decodeService) {
        this.decodeService = decodeService;
        this.documentPageCount = decodeService.getPageCount();
        this.pageWidth = decodeService.getPageWidth(0);
        this.pageHeight = decodeService.getPageHeight(0);
        this.state = State.LOADED;
        calculateOptimalWidthAndHeight();
        jumpTo(this.defaultPage);
        OnLoadCompleteListener onLoadCompleteListener = this.onLoadCompleteListener;
        if (onLoadCompleteListener != null) {
            onLoadCompleteListener.loadComplete(this.documentPageCount);
        }
    }

    public void onBitmapRendered(PagePart pagePart) {
        if (pagePart.isThumbnail()) {
            this.cacheManager.cacheThumbnail(pagePart);
        } else {
            this.cacheManager.cachePart(pagePart);
        }
        invalidate();
    }

    private int determineValidPageNumberFrom(int i) {
        if (i <= 0) {
            return 0;
        }
        int[] iArr = this.originalUserPages;
        if (iArr != null) {
            if (i >= iArr.length) {
                return iArr.length - 1;
            }
        } else {
            int i2 = this.documentPageCount;
            if (i >= i2) {
                return i2 - 1;
            }
        }
        return i;
    }

    private float calculateCenterOffsetForPage(int i) {
        float f;
        float width;
        float f2;
        if (this.swipeVertical) {
            f = -(i * this.optimalPageHeight);
            width = getHeight() / 2;
            f2 = this.optimalPageHeight;
        } else {
            f = -(i * this.optimalPageWidth);
            width = getWidth() / 2;
            f2 = this.optimalPageWidth;
        }
        return f + (width - (f2 / 2.0f));
    }

    private void calculateOptimalWidthAndHeight() {
        if (this.state == State.DEFAULT || getWidth() == 0) {
            return;
        }
        float width = getWidth();
        float height = getHeight();
        float f = this.pageWidth / this.pageHeight;
        float floor = (float) Math.floor(width / f);
        if (floor > height) {
            width = (float) Math.floor(f * height);
        } else {
            height = floor;
        }
        this.optimalPageWidth = width;
        this.optimalPageHeight = height;
        calculateMasksBounds();
        calculateMinimapBounds();
    }

    private void calculateMinimapBounds() {
        float min = Math.min(200.0f / this.optimalPageWidth, 200.0f / this.optimalPageHeight);
        this.minimapBounds = new RectF((getWidth() - 5) - (this.optimalPageWidth * min), 5.0f, getWidth() - 5, (this.optimalPageHeight * min) + 5.0f);
        calculateMinimapAreaBounds();
    }

    private void calculateMinimapAreaBounds() {
        if (this.minimapBounds == null) {
            return;
        }
        if (this.zoom == 1.0f) {
            this.miniMapRequired = false;
            return;
        }
        float currentScale = (((-this.currentXOffset) - toCurrentScale(this.currentFilteredPage * this.optimalPageWidth)) / toCurrentScale(this.optimalPageWidth)) * this.minimapBounds.width();
        float width = (getWidth() / toCurrentScale(this.optimalPageWidth)) * this.minimapBounds.width();
        float currentScale2 = ((-this.currentYOffset) / toCurrentScale(this.optimalPageHeight)) * this.minimapBounds.height();
        this.minimapScreenBounds = new RectF(this.minimapBounds.left + currentScale, this.minimapBounds.top + currentScale2, this.minimapBounds.left + currentScale + width, this.minimapBounds.top + currentScale2 + ((getHeight() / toCurrentScale(this.optimalPageHeight)) * this.minimapBounds.height()));
        this.minimapScreenBounds.intersect(this.minimapBounds);
        this.miniMapRequired = true;
    }

    private void calculateMasksBounds() {
        this.leftMask = new RectF(0.0f, 0.0f, (getWidth() / 2) - (toCurrentScale(this.optimalPageWidth) / 2.0f), getHeight());
        this.rightMask = new RectF((getWidth() / 2) + (toCurrentScale(this.optimalPageWidth) / 2.0f), 0.0f, getWidth(), getHeight());
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0052  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x00c1  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x0124  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x0191  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void moveTo(float r8, float r9) {
        /*
            Method dump skipped, instructions count: 437
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.joanzapata.pdfview.PDFView.moveTo(float, float):void");
    }

    public void moveRelativeTo(float f, float f2) {
        moveTo(this.currentXOffset + f, this.currentYOffset + f2);
    }

    public void zoomTo(float f) {
        this.zoom = f;
        calculateMasksBounds();
    }

    public void zoomCenteredTo(float f, PointF pointF) {
        float f2 = f / this.zoom;
        zoomTo(f);
        moveTo((this.currentXOffset * f2) + (pointF.x - (pointF.x * f2)), (this.currentYOffset * f2) + (pointF.y - (pointF.y * f2)));
    }

    public void zoomCenteredRelativeTo(float f, PointF pointF) {
        zoomCenteredTo(this.zoom * f, pointF);
    }

    public int getCurrentPage() {
        return this.currentPage;
    }

    public float getCurrentXOffset() {
        return this.currentXOffset;
    }

    public float getCurrentYOffset() {
        return this.currentYOffset;
    }

    public float toRealScale(float f) {
        return f / this.zoom;
    }

    public float toCurrentScale(float f) {
        return f * this.zoom;
    }

    public float getZoom() {
        return this.zoom;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public DecodeService getDecodeService() {
        return this.decodeService;
    }

    public boolean isZooming() {
        return this.zoom != 1.0f;
    }

    public float getOptimalPageWidth() {
        return this.optimalPageWidth;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void setUserWantsMinimap(boolean z) {
        this.userWantsMinimap = z;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void setDefaultPage(int i) {
        this.defaultPage = i;
    }

    public void resetZoom() {
        zoomTo(1.0f);
    }

    public void resetZoomWithAnimation() {
        this.animationManager.startZoomAnimation(this.zoom, 1.0f);
    }

    public Configurator fromAsset(String str) {
        try {
            return fromFile(FileUtils.fileFromAsset(getContext(), str));
        } catch (IOException e) {
            throw new FileNotFoundException(str + " does not exist.", e);
        }
    }

    public Configurator fromFile(File file) {
        if (!file.exists()) {
            throw new FileNotFoundException(file.getAbsolutePath() + "does not exist.");
        }
        return new Configurator(Uri.fromFile(file));
    }

    /* loaded from: classes.dex */
    public class Configurator {
        private int defaultPage;
        private boolean enableSwipe;
        private int maskAlpha;
        private int maskColor;
        private OnDrawListener onDrawListener;
        private OnLoadCompleteListener onLoadCompleteListener;
        private OnPageChangeListener onPageChangeListener;
        private int[] pageNumbers;
        private boolean showMinimap;
        private boolean swipeVertical;
        private final Uri uri;

        private Configurator(Uri uri) {
            this.pageNumbers = null;
            this.enableSwipe = true;
            this.defaultPage = 1;
            this.showMinimap = false;
            this.swipeVertical = false;
            this.maskColor = -16777216;
            this.maskAlpha = 20;
            this.uri = uri;
        }

        public Configurator pages(int... iArr) {
            this.pageNumbers = iArr;
            return this;
        }

        public Configurator enableSwipe(boolean z) {
            this.enableSwipe = z;
            return this;
        }

        public Configurator onDraw(OnDrawListener onDrawListener) {
            this.onDrawListener = onDrawListener;
            return this;
        }

        public Configurator onLoad(OnLoadCompleteListener onLoadCompleteListener) {
            this.onLoadCompleteListener = onLoadCompleteListener;
            return this;
        }

        public Configurator onPageChange(OnPageChangeListener onPageChangeListener) {
            this.onPageChangeListener = onPageChangeListener;
            return this;
        }

        public Configurator defaultPage(int i) {
            this.defaultPage = i;
            return this;
        }

        public Configurator swipeVertical(boolean z) {
            this.swipeVertical = z;
            return this;
        }

        public Configurator mask(int i, int i2) {
            this.maskColor = i;
            this.maskAlpha = i2;
            return this;
        }

        public void load() {
            PDFView.this.recycle();
            PDFView.this.setOnDrawListener(this.onDrawListener);
            PDFView.this.setOnPageChangeListener(this.onPageChangeListener);
            PDFView.this.enableSwipe(this.enableSwipe);
            PDFView.this.setDefaultPage(this.defaultPage);
            PDFView.this.setUserWantsMinimap(this.showMinimap);
            PDFView.this.setSwipeVertical(this.swipeVertical);
            PDFView.this.dragPinchManager.setSwipeVertical(this.swipeVertical);
            PDFView.this.maskPaint = new Paint();
            PDFView.this.maskPaint.setColor(this.maskColor);
            PDFView.this.maskPaint.setAlpha(this.maskAlpha);
            int[] iArr = this.pageNumbers;
            if (iArr != null) {
                PDFView.this.load(this.uri, this.onLoadCompleteListener, iArr);
            } else {
                PDFView.this.load(this.uri, this.onLoadCompleteListener);
            }
        }

        public Configurator showMinimap(boolean z) {
            this.showMinimap = z;
            return this;
        }
    }

    public boolean isSwipeVertical() {
        return this.swipeVertical;
    }

    public void setSwipeVertical(boolean z) {
        this.swipeVertical = z;
    }
}
